<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="shortcut icon" href="C:\Users\zzz\Desktop\Reac\favicon.ico" />
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="../../js/react.development.js"></script>
    <script src="../../js/react-dom.development.js"></script>
    <script src="../../js/prop-types.js"></script> 
    <script src="../../js/babel.min.js"></script>
    <script type="text/babel">
        /*
        高级函数：
        接受的参数为函数
        a为函数返回值依然是函数
        */
    class A extends React.Component {
        state = {carname: 'benz'}

        changeC = ()=> {

            this.setState({carName: 'AOTU'})
        }
        render() {
            return(            
                <div>
                    <div>A IS HERE</div>
                    <button onClick={this.changeC}>Change</button>
                        <B carName={this.state.carname}/>
                    </div>
            )
        }
    }

    class   B extends React.Component {
        render() {
            return(            
                <div>B :{this.props.carName} </div>
            )
        }
    }

    ReactDOM.render(<A/>,document.getElementById('root'))

    
    </script>
  </body>
</html>
